﻿using AutoMapper;
using MediatR;
using SheepStorage.API.Application.Command.SheepRecordCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepRecordHandlers
{
    public class DelSheepRecordCommandHandler : IRequestHandler<DelSheepRecordCommand, Results<int>>
    {
        ISheepRecordService _service;
        IMapper _mapper;
        public DelSheepRecordCommandHandler(ISheepRecordService service, IMapper mapper)
        {
            _service = service;
            _mapper = mapper;
        }
        public async Task<Results<int>> Handle(DelSheepRecordCommand request, CancellationToken cancellationToken)
        {
            var list = await _service.DelSheepRecord(request.ids);
            return  Results<int>.DataResult(list);
        }
    }
}
